<%@ page import="com.interfaces.SendAgentController" %>
<%@ page import="com.core.sendAgent.pojo.SendAgent" %>
<%@ page import="com.core.sendAgent.SendAgentJspKeys" %>
<%@ page import="com.core.sysDict.SysDictJsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>修改送签社信息</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <%
    	String path = request.getContextPath();
                    path = "/".equals(path)?"":path;
                    request.setAttribute("path", path);
                    String sysDictJson=SysDictJsp.getSysDictJson(session);
    %>
    <script type="text/javascript">
        var path = "${path}";
    </script>

    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="${path}/public/adminlte/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="${path}/public/font-awesome-4.7.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="${path}/public/ionicons/ionicons.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="${path}/public/adminlte/plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="${path}/public/adminlte/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
          page. However, you can choose any other skin. Make sure you
          apply the skin class to the body tag so the changes take effect.
    -->
    <link rel="stylesheet" href="${path}/public/adminlte/dist/css/skins/_all-skins.min.css">

    <link rel="stylesheet" href="${path}/css/common.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script type="text/javascript" src="${path}/js/json2.js"></script>
</head>
<!--
BODY TAG OPTIONS:
=================
Apply one or more of the following classes to get the
desired effect
|---------------------------------------------------------|
| SKINS         | skin-blue                               |
|               | skin-black                              |
|               | skin-purple                             |
|               | skin-yellow                             |
|               | skin-red                                |
|               | skin-green                              |
|---------------------------------------------------------|
|LAYOUT OPTIONS | fixed                                   |
|               | layout-boxed                            |
|               | layout-top-nav                          |
|               | sidebar-collapse                        |
|               | sidebar-mini                            |
|---------------------------------------------------------|
-->
<body >
<%
	SendAgent sendAgent = (SendAgent) request.getAttribute(SendAgentJspKeys.JspParam_SendAgent);
%>

<div class="container">
            <div class="row">
                 <div class="col-md-4">
                    <div class="form-group">
                        <label for="txtsendAgentName">送签社名称</label>
                        <input type="text" class="form-control" id="txtsendAgentName"value="${sendAgent.sendAgentName}">
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="txtSendcode">送签社代码</label>
                        <input type="text"  class="form-control" id="txtSendcode" value="${sendAgent.code}">
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="sendAgentField">送签社归属领区</label>
                        <input type="text"  class="form-control" id="sendAgentField" value="${sendAgent.sendAgentField}">
                    </div>
                </div>
            </div>
            <div class="row">
            	<div class="col-md-4">
                    <div class="form-group" id="txtid1">
                        <label for="txtid">送签社id</label>
                        <input type="text" class="form-control" id="txtid" readonly="readonly" value="${sendAgent.id}">
                    </div> 
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <button type="submit" class="btn btn-primary" id="btnUpdate">保 存</button>
                </div>
            </div>
<!-- ./wrapper -->
</div>
<!-- REQUIRED JS SCRIPTS -->

<!-- jQuery 2.2.3 -->
<script src="${path}/public/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="${path}/public/adminlte/bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="${path}/public/adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="${path}/public/adminlte/plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="${path}/public/adminlte/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="${path}/public/adminlte/plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="${path}/public/adminlte/dist/js/app.min.js"></script>
<!-- Optionally, you can add Slimscroll and FastClick plugins.
     Both of these plugins are recommended to enhance the
     user experience. Slimscroll is required when using the
     fixed layout. -->
<!-- page script -->
<script>
$("#txtid1").hide();
$(function () {
    $("#btnUpdate").click(function () {
         var sendAgentId = $("#txtid").val();
        if(sendAgentId == ""){
            alert("请输入送签社代码");
            return;
        } 

         var sendAgentName = $("#txtsendAgentName").val();
        if(sendAgentName == ""){
            alert("请输入送签社机构名称");
            return;
        } 
        var sendAgentField = $("#sendAgentField").val();
        if(sendAgentField == ""){
            alert("请输入送签社机构领域");
            return;
        } 
        var code = $("#txtSendcode").val();
        if(sendAgentName == ""){
            alert("请输入送签社机构代码");
            return;
        } 
        $.ajax({
            url:"${path}<%=SendAgentController.URL_UPDATE%>",
            type:"post",
            data:{
                id:sendAgentId,
                sendAgentName:sendAgentName,
				sendAgentField:sendAgentField,
				code:code
            },
            success:function(result){
                var re = JSON.parse(result);
                if(re.returnCode=="0"){
                	alert("修改旅行社信息成功！");
                	var url= window.location.search;
                	var arr = url.split('&');
                	parent.refresh(arr[arr.length-1]);
                }else{
                    alert(re.msg);
                }
            },
            error:function(request) {      // 设置表单提交出错
                alert(request);  //登录错误提示信息
            }
        });

        return false;
     });
     });
</script>
</body>
</html>
 